#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main(void)
{
    char arr[] = "ABCDEF";
    int i = 0, j = 0;
    double sum = 0.0;
    char ch = arr[0];
    int num[10] = { 0 };
    int n = strlen(arr);
    int m = 0;
    while (ch != '\0')
    {
        ch = arr[i];
        switch (ch)
        {
        case 'A':num[j] = 10;
            break;
        case 'B':num[j] = 11;
            break;
        case 'C':num[j] = 12;
            break;
        case 'D':num[j] = 13;
            break;
        case 'E':num[j] = 14;
            break;
        case 'F':num[j] = 15;
            break;
        default: break;
        }
        if (num[i] != 0)
        {
            i++;
            j++;
        }
    }
    for (i = n - 1; i >= 0; i--)
        sum += num[i] * pow(16, n - 1 - i);
    m = (int)sum;
    printf("%15d", m);
    return 0;
}
